-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: handle FlowControllerTest thread start variation by polling #1586
Conversation
@suztomo , @blakeli0 , and/or @meltsufin : PTAL when you have a moment. |
gax-java/gax/src/test/java/com/google/api/gax/batching/FlowControllerTest.java
Outdated
Show resolved
Hide resolved
gax-java/gax/src/test/java/com/google/api/gax/batching/AssertByPollingTest.java
Outdated
Show resolved
Hide resolved
Stopwatch stopwatch = Stopwatch.createStarted(); | ||
while (true) { | ||
try { | ||
assertion.run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have: Inspired by your test, maybe we can have a counter that counts how many times we tried before a successful assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you have in mind for how it would be used? When successful, it currently proceeds without logging anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you have in mind for how it would be used? When successful, it currently proceeds without logging anything.
We can add logs to show that how many times we tried when successful, so that it could be useful if we want to check previously successful runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I smell YAGNI here.
When we really want to measure certain operations, I think we would write a simple Java code to run the operation. Then we would run it against old code by checking out release tags via Git.
gax-java/gax/src/test/java/com/google/api/gax/batching/AssertByPolling.java
Outdated
Show resolved
Hide resolved
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed!
|
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed!
|
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed!
|
Fixes #1286
Issue: "Expected thread to be WAITING (blocked) but instead was RUNNABLE (had not been started yet, or had not yet reached the blocking logic.)"
This PR increases the amount of time spent waiting for the thread to be blocked, while also implementing a polling assertion mechanism to prevent waiting the maximum amount of time.
Also: Raw types fixed in this file.